package com.leileimann.tour.controller.Userpages;

import com.leileimann.tour.entity.*;
import com.leileimann.tour.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author leileiMann
 * @date 2022/3/7 15:35
 */
@RestController
@RequestMapping("/city")
public class CityController {

    @Autowired
    CityMapper cityMapper;
    @Autowired
    SSpotMapper sSpotMapper;
    @Autowired
    RestaurantMapper restaurantMapper;
    @Autowired
    HotelMapper hotelMapper;
    @Autowired
    ShopPlaceMapper shopPlaceMapper;

    /**
     * 获取所有城市*/
    @GetMapping("/getAllCity")
    public List<City> getAllCity(Integer pageNum){
        return cityMapper.getAllCity(pageNum);
    }
    /**
     * 获取所有的景点*/
    @GetMapping("/getAllSSpot")
    public List<SSpot> getAllSSpot(int pagenum){
        return sSpotMapper.getAllSSpot(pagenum);
    }
    /**
     * 获取前12的景点 贵阳用
     * */
    @GetMapping("/getTop10SSpot")
    public List<SSpot> getTop10SSpot(){
        int pageNum =10;
        String cityname = "贵阳";
        return sSpotMapper.getSSpotByCityName(cityname,pageNum);
    }
    /**
     * 获取所有的餐厅
     * */
    @GetMapping("/getAllRestaurant")
    public List<Restaurant> getAllRestaurant(){
        return restaurantMapper.getAllRestaurant();
    }
    /**
     * 获取所有的酒店
     * */
    @GetMapping("/getAllHotel")
    public List<Hotel> getAllHotel(){
        return hotelMapper.getAllHot();
    }
    /**
     * 获取所有的购物点
     * */
    @GetMapping("/getAllShopPlaces")
    public List<ShopPlace> getAllShopPlaces(){
        return shopPlaceMapper.getAllShopPlaces();
    }
    /**
     * 根据城市名称获取购物点
     * */
    @GetMapping("/getShopPlaceByCityName")
    public List<ShopPlace> getShopPlaceByCityName(String cityname,int pageNum){
        return shopPlaceMapper.getShopByCityName(cityname,pageNum);
    }
    /**
     * 根据城市名查找城市
     * */
    @GetMapping("/getCityByCityName")
    public City getCityByCityName(String cityname){
        return cityMapper.getCityByCityName(cityname);
    }



}
